{extend name="ashippingterminal/Public/base" /}
{block name="container"}
<script src="__STATIC__/layout/js/plugins/laydate/laydate.js"></script>
<div class="page-heade">
    <h2 class="title_color text-center">导购员班次设置</h2>
</div>
<form action="{:url('schedulingsetform')}" class="form-inline" id="form1" method="post">
    <table class="table table-bordered text-center table-striped table-hover row-margin-top bud_hei">
        <tr class="info">
            <td>No.</td>
            <td>是否显示</td>
            <td>显示顺序</td>
            <td>班次名称</td>
            <td>上下班时间段</td>
            <td>班次应上班时长</td>
            <td>是否正常班次</td>
            <td>最后修改时间</td>
            <td>最后修改人</td>
            <td>说明</td>
        </tr>
        {volist name="data" id="list"}
        <tr>
            <td>{$i}</td>
            <input type="hidden" value="{$list.id}" name="id[{$list.id}]">
            <td><input type="checkbox" {if condition="$list['isShow'] == 1"}checked{/if} value="1" name="isShow[{$list.id}]" id="isShow"></td>
            <td><input type="text" name="sort[{$list.id}]" id="sort{$i}" style="width: 40px" value="{$list.sort}" class="form-control validate[custom[integer]]"></td>
            <td><input type="text" name="className[{$list.id}]" id="className{$i}" style="width: 120px" value="{$list.className}" class="form-control validate[required]"></td>
            <td><input type="text" name="workShift[{$list.id}]" id="time{$i}" style="width: 70px" class="form-control daytime validate[required]" value="{$list.workShift}">--<input type="text" name="closingTime[{$list.id}]" id="time1{$i}" style="width: 70px" class="form-control daytime validate[required]" value="{$list.closingTime}"></td>
            <td><input type="text" name="workLong[{$list.id}]" id="workLong{$i}" value="{$list.workLong}" class="form-control validate[required]"></td>
            <td>
                <label for="isOk{$i}">
                    <input type="radio" name="isNormalShift[{$list.id}]" id="isOk{$i}"  value="1" {if condition="$list['isNormalShift'] == 1"} checked {/if}>是
                </label>
                <label for="isNo{$i}">
                    <input type="radio" name="isNormalShift[{$list.id}]" id="isNo{$i}" value="0" {if condition="$list['isNormalShift'] == 0"} checked {/if}>否
                </label>
            </td>
            <td>{$list.lastEditDate}</td>
            <td>{$list.em_name}</td>
            <td><input type="text" name="des[{$list.id}]"  value="{$list.des}" class="form-control"></td>
        </tr>
        {/volist}
    </table>

    <div class="padding-10 text-danger">
        <p>说明：</p>
        <p style="padding: 3px 0 3px 26px">1.系统已默认设置休息班次。</p>
        <p style="padding: 3px 0 3px 26px">2.“是否正常班次”如选“是”则认为该班次是正常计算销售的班次，“所有（或所属）导购月销量统计”中的“正常班次”以此为依据进行统计，同时会影响该统计表的“日均销售金额”（该报表的“日均销售金额”计算公式为：月销售金额÷正常班次数量）;“休息”班次默认为不属于“正常班次”. </p>
        <p style="padding: 3px 0 3px 26px">3.班次显示顺序只能填写数字，手机端在排班时点击班次，默认的显示顺序按照填写的数字从小到大向下排序。</p>
    </div>
    <div class="text-center padding-10">
        <button class="btn btn-success" type="submit">保存</button>
    </div>
</form>

<script>
    $('#form1').validationEngine('attach', {
        promptPosition: 'bottomRight'
    });
    $(document).ready(function () {
        var $input = $("table tbody tr td").find("input");
        $input.each(function(){
            if($(this).val()=="休息"){
                $(this).attr("readonly","readonly");
                $(this).parent().siblings("td").find("input[type='radio']").attr("disabled","disabled")
                $(this).parent().siblings("td").find("input[type='checkbox']").attr("disabled","disabled")
                $(this).parent().siblings("td").find("input[type='text']").attr("readonly","readonly")
            }
        })

    })

    $(".daytime").each(function(){
        laydate.render({
            elem: this,
            type:'time',
            format: 'HH:mm:ss',
            trigger: 'click'
        });
    });
</script>
{/block}
